 <me:UIPRNDEF x:Class="HappyPrint.Views.PrintPreviewView"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:converter="clr-namespace:HappyPrint.Converter"
        xmlns:happyPrint="clr-namespace:HappyPrint"  
          xmlns:me="clr-namespace:WPFExcelReport"  
        Width="1100" 
        Height="800" 
          x:Name="TV"
               Loaded="Window_Loaded">
    <me:UIPRNDEF.Resources>
        <converter:PageIndexConverter x:Key="PageIndexConverter"></converter:PageIndexConverter>
        <converter:OrientationToBoolConverter x:Key="OrientationToBoolConverter"></converter:OrientationToBoolConverter>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter>
    </me:UIPRNDEF.Resources>
    <Grid x:Name="Grid" IsEnabled="{Binding ControlStatus,Mode=TwoWay}">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="700"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions> 
        <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,0,10,0">
            <RadioButton x:Name="HCheck" Content="Landscape" VerticalAlignment="Center" IsChecked="{Binding PageOrientation,Converter={StaticResource OrientationToBoolConverter},ConverterParameter=Landscape}"></RadioButton>
            <RadioButton x:Name="VCheck" Content="Portrait" VerticalAlignment="Center" IsChecked="{Binding PageOrientation,Converter={StaticResource OrientationToBoolConverter},ConverterParameter=Portrait}"></RadioButton>
        </StackPanel>

        <StackPanel Grid.Row="0" HorizontalAlignment="Left" Orientation="Horizontal" Margin="10,0,0,0">
            <TextBlock Text="Printer:" VerticalAlignment="Center"></TextBlock>
            <ComboBox Width="200"
                      VerticalContentAlignment="Center"
                      ItemsSource="{Binding PrintQueues}" 
                      SelectedItem="{Binding CurrentPrintQueue}" 
                      DisplayMemberPath="Name">
            </ComboBox>
            <TextBlock Margin="10,0,0,0" Text="PaperSize:" VerticalAlignment="Center"></TextBlock>
            <ComboBox Width="150" VerticalContentAlignment="Center" ItemsSource="{Binding PageMediaSizes}" SelectedItem="{Binding PageSize}" DisplayMemberPath="PageMediaSizeName"></ComboBox>
        </StackPanel> 
        <Grid Grid.Row="1" Background="DarkGray">
            <ScrollViewer Padding="10" HorizontalScrollBarVisibility="Visible">
                <happyPrint:DrawingCanvas x:Name="drawingCanvas">
                    <happyPrint:DrawingCanvas.Effect>
                        <DropShadowEffect ShadowDepth="1"></DropShadowEffect>
                    </happyPrint:DrawingCanvas.Effect>
                </happyPrint:DrawingCanvas>
            </ScrollViewer>
        </Grid> 
        <Grid Grid.Row="2">

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                <Button ToolTip="Pre" ToolTipService.ShowOnDisabled="True" Width="30" Height="30" Content="Pre" Margin="0,0,5,0" Command="{Binding LastPageCommand}"></Button>
                <TextBlock VerticalAlignment="Center">
                    <Run Text="{Binding CurrentPageIndex,Converter={StaticResource PageIndexConverter}}"></Run>
                    <Run Text="/"></Run>
                    <Run Text="{Binding PageCount}"></Run>
                </TextBlock>
                <Button ToolTip="Next" ToolTipService.ShowOnDisabled="True" Width="30" Height="30" Content="Next" Margin="5,0,0,0" Command="{Binding NextPageCommand}"></Button>
            </StackPanel>

            <StackPanel Visibility="{Binding ShowProgress,Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0">
                <TextBlock Text="Progress:" VerticalAlignment="Center"></TextBlock>
                <ProgressBar Width="200" Height="25" SmallChange="1" Minimum="0" Maximum="100" IsIndeterminate="{Binding IsIndeterminate}" Value="{Binding ProgressValue}"></ProgressBar>
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
                <TextBox x:Name="StartPage" Width="50" VerticalAlignment="Center" Height="30" 
                          Text="{Binding StartIndex,Converter={StaticResource PageIndexConverter},UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <TextBlock Text="To" VerticalAlignment="Center"></TextBlock>
                <TextBox x:Name="EndPage"  Width="50" Height="30"   Text="{Binding EndIndex,Converter={StaticResource PageIndexConverter},UpdateSourceTrigger=PropertyChanged}"></TextBox>
                <Button ToolTip="PageRange" ToolTipService.ShowOnDisabled="True" Width="100" Height="30" Content="PageRange" x:Name="PageRangeBtn" Command="{Binding PrintRangeCommand}"></Button>
                <Button ToolTip="Current" ToolTipService.ShowOnDisabled="True" Width="100" Height="30" Content="Current" x:Name="CurrentBtn" Command="{Binding PrintCurrentCommand}"></Button>
                <Button ToolTip="All" ToolTipService.ShowOnDisabled="True" Width="100" Height="30" Content="All" x:Name="AllBtn" Command="{Binding PrintAllCommand}"></Button>
            </StackPanel>

        </Grid>
    </Grid>
</me:UIPRNDEF>